import {createRouter, createWebHashHistory} from "vue-router";
import {errorRouter} from './staticRouters'

const routes = [
    {
        path: '/',
        component: () => import('@/layouts/index.vue'), // 指向布局
        children: [
            {
                path: '/',
                name: '/',
                component: () => import('@/views/Home/index.vue'),
                meta: {
                    title: '首页',
                }
            },
            {
                path: '/device',
                name: '/device',
                component: () => import('@/views/DeviceManagement/index.vue'), // 指向设备管理模块
                meta: {
                    title: '设备管理',
                }
            },
            {
                path: '/warning', //指向模型预警模块
                name: '/warning',
                component: () => import('@/views/DiseaseWarning/index.vue'),
                meta: {
                    title: '模型预警',
                }
            },
            {
                path: '/device/management',
                name: '/device/management',
                component: () => import('@/views/DeviceManagement/pages/Device_management.vue'),
                meta: {
                    title: '传感器设备管理',
                }
            },
            {
                path: '/device/view',
                name: '/device/view',
                component: () => import('@/views/DeviceManagement/pages/Device_view.vue'),
                meta: {
                    title: '传感器数据查看',
                }
            },
            {
                path: '/device/camera',
                name: '/device/camera',
                component: () => import('@/views/DeviceManagement/pages/Camera_management.vue'),
                meta: {
                    title: '摄像头设备管理',
                }
            },
            {
                path: '/disease', //指向病虫害预警模块
                component: () => import('@/views/DiseaseWarning/pages/DiseaseWarning.vue'),
                meta: {
                    title: '病虫害预警',
                },
            },
            {
                path: '/disease/data-visualization',
                component: () => import('@/views/DiseaseWarning/pages/DataVisualization/index.vue'),
                meta: {
                    title: '数据可视化',
                },
            },
            {
                path: '/disease/historical-data',
                component: () => import('@/views/DiseaseWarning/pages/HistoricalData.vue'),
                meta: {
                    title: '历史数据',
                },
            },
            {
                path: '/disease/real-time-data',
                component: () => import('@/views/DiseaseWarning/pages/Real-timeData.vue'),
                meta: {
                    title: '当前数据',
                },
            },
            {
                path: '/disease/disease-warning',
                component: () => import('@/views/DiseaseWarning/pages/DiseaseWarning.vue'),
                meta: {
                    title: '病害预警',
                },
            },
            {
                path: '/disease/prevention-control-info',
                component: () => import('@/views/DiseaseWarning/pages/PreventionAndControlInformation.vue'),
                meta: {
                    title: '防治信息',
                },
            },
            {
                path: '/disease/data-import',
                component: () => import('@/views/DiseaseWarning/pages/DataImport.vue'),
                meta: {
                    title: '数据导入',
                },
            },
            {
                path: '/disease/report-export',
                component: () => import('@/views/DiseaseWarning/pages/ReportExport.vue'),
                meta: {
                    title: '报表导出',
                },
            },
            {
                path: '/disease/scheduled-tasks',
                component: () => import('@/views/DiseaseWarning/pages/ScheduledTasks.vue'),
                meta: {
                    title: '定时任务',
                },
            },
            {
                path: '/disease/notification-system',
                component: () => import('@/views/DiseaseWarning/pages/NotificationSystem.vue'),
                meta: {
                    title: '消息通知',
                },
            },
            {
                path: '/model', //指向模型应用模块
                name: '/model',
                component: () => import('@/views/ModelApplication.vue'),
                meta: {
                    title: '模型应用',
                }
            },
        ]
    },
    {
        path: "/login",
        component: () => import('@/views/login/index.vue'),
        meta: {
            title: "登录页"
        }
    },
    ...errorRouter,
]

export const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router
